package flc.ast.adapter;

import android.graphics.Color;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.PorterDuff;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.constraintlayout.utils.widget.ImageFilterView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyPictureFilterBean;
import flc.ast.bean.MyStickerBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class StickerAdapter extends StkProviderMultiAdapter<MyStickerBean> {

    public StickerAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(76));
        addItemProvider(new StickerProvider());
    }

    private class StickerProvider extends BaseItemProvider<MyStickerBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sticker;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyStickerBean bean) {
            Glide.with(baseViewHolder.itemView).load("file:///android_asset/" + bean.getPath()).into((ImageView) baseViewHolder.getView(R.id.ivStickerItemImg));
            if (bean.isSelect()) {
                baseViewHolder.getView(R.id.ivStickerItemSel).setVisibility(View.VISIBLE);
            } else {
                baseViewHolder.getView(R.id.ivStickerItemSel).setVisibility(View.INVISIBLE);
            }
        }
    }
}
